<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>绝对定位示例 3</title>
    <style>
        body {
            width: 100vw;
            margin: 0px;
        }

        .parent {
            position: relative;
            /* 默认值，可以省略 */
            width: 320px;
            height: 200px;
            background-color: lightblue;
            z-index: 99;
        }

        .child {
            position: relative;
            width: 100px;
            height: 100px;
            background-color: lightcoral;
            right: 0px;
            top: 0px;
            z-index: -1;
        }


        .wc {
            position: absolute;
            width: 300px;
            height: 300px;
            background-color: rgb(216, 240, 128);
            right: 0px;
            top: 0px;
            z-index: -1;
        }

    </style>
</head>

<body>
    <div class="parent">
        <div class="child">子元素</div>
    </div>
    <div class="wc">wc</div>
</body>

</html>